package com.geezdata.cps.cqrs.event;

public class AbstractEvent<T> implements Event<T> {
    private String name;
    protected T payload;

    public AbstractEvent(T payload) {
        this.payload = payload;
    }

    public AbstractEvent(String name, T payload) {
        this.name = name;
        this.payload = payload;
    }
    
    @Override
    public String getName() {
        if (name == null) {
            return getClass().getSimpleName();
        }
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public T getPayLoad() {
        return this.payload;
    }

    @Override
    public void setPayLoad(T payLoad) {
        this.payload = payLoad;
    } 
}
